package n03;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class N03 {
	//用try...catch来捕获异常并进行处理。
	public static void main(String[] args) {
		Path p1=Paths.get("C:/1/tmp.txt");
      	Path p2=Paths.get("C:/1/tmp2.txt");
      	try {
			Files.move(p1, p2);
			System.out.println("改名成功~");
		} catch (IOException e) {
//			e.printStackTrace();
			System.out.println(e.getMessage());
			System.out.println("改名失败~");
		}
      	System.out.println("程序结束~");

	}
}
